/*
 * @Description: 新建检测方案 - 条目检测规则面板
 * @Author: Rfan
 * @Date: 2022-10-10 11:23:21
 * @LastEditTime: 2022-10-14 14:35:33
 */

import { Tabs } from 'antd';
import { CheckProps } from '@/view/system/ArchivesDetection/dictionaries';
import EntryIntegrityCheck from './IntegrityCheck';
import EntryAuthentication from './Authentication';
import EntryUsabilityCheck from './UsabilityCheck';
import type { IBaseDic } from '@/interfaces/global';
import type { IRefList } from '../index';

const { TabPane } = Tabs;

interface IEntryPanesProps {
  paneList: IBaseDic[];
  refList: IRefList;
}

const EntryPanes = (props: IEntryPanesProps) => {
  const { paneList, refList } = props;

  return (
    <>
      {paneList.map((item: any) => (
        <TabPane tab={item.name} key={item.id} forceRender>
          {item.id === CheckProps.Authenticity && (
            <EntryAuthentication ref={refList.authenticationRef} />
          )}
          {item.id === CheckProps.Integrity && <EntryIntegrityCheck ref={refList.integrityRef} />}
          {item.id === CheckProps.Usability && <EntryUsabilityCheck ref={refList.usabilityRef} />}
        </TabPane>
      ))}
    </>
  );
};

export default EntryPanes;
